import javax.swing.*;

import java.awt.*;

public class Weapon extends JPanel
{
	private ImageIcon imageArray[];
	   private Image wp;
	   public int width;
	   Rectangle weaponBox;
	   public int height;
	   private int  /*how many pictures*/totalFrames = 12 ,/*frame you are on*/ currentFrame =0;
	   
	   //creates the placement for the shape
	   private int x, y;
	   //creates for the movement
	   boolean moveUp, moveDown, moveLeft, moveRight;
	   


	   public Weapon()
	   {

	      //creates array for images
	     
	      imageArray = new ImageIcon[totalFrames];
	      
	      
	      //adds every image icon in order to the array
	      for (int i =0; i<imageArray.length-9;i++)
	      {
	         imageArray[i] = new ImageIcon("SwordSwing"+(i+1)+".png");
	      }
	      for (int i =3; i<imageArray.length-6;i++)
	      {
	    	  imageArray[i] = new ImageIcon("SwordSwing"+(i+1)+".png");	         
	      }
	      for (int i =6; i<imageArray.length-3;i++)
	      {
	    	  imageArray[i] = new ImageIcon("SwordSwing"+(i+1)+".png");	         
	      }
	      for (int i =9; i<imageArray.length;i++)
	      {
	    	  imageArray[i] = new ImageIcon("SwordSwing"+(i+1)+".png");	         
	      }
	     
	      wp = imageArray[currentFrame].getImage();
	      
	      
	      //gets height and width of image
	      width = wp.getWidth(null);
	      height = wp.getHeight(null);
	      weaponBox = new Rectangle(x, y, width, height);

	   }
	   

	   
	   
	//gets the bounds of the player
	  public Rectangle getBounds() 
	  {
	      return weaponBox;
	  }
	  public void changeBounds(int x, int y)
	  {
	     weaponBox = new Rectangle(x, y, width = wp.getWidth(null), height = wp.getHeight(null));
	  }
	  
	  //gets the image of the weapon
	   public Image weapon()
	   {
	      return wp;
	   }
	   
	   public void setMoveUp(boolean in)
	   {
	      moveUp=in;
	   }
	   public void setMoveDown(boolean in)
	   {
	      moveDown=in;
	   }
	   public void setMoveLeft(boolean in)
	   {
	      moveLeft=in;
	   }
	   public void setMoveRight(boolean in)
	   {
	      moveRight = in;
	   }
	   
	   //gets movement
	   public boolean getUp()
	   {
	      return moveUp;
	   }
	   public boolean getDown()
	   {
	      return moveDown;
	   }
	   public boolean getLeft()
	   {
	      return moveLeft;
	   }
	   public boolean getRight()
	   {
	      return moveRight;
	   }
	   
	   //gets the x and y values
	   public int getX()
	   {
	      return x;
	   }
	   
	   public int getY()
	   {
	      return y;
	   }
	   public void setX(int xin)
	   {
	    x = xin;  
	   }
	   public void setY(int yin)
	   {
	      y=yin;
	   }
	   public int getWidth()
	   {
	      return width;
	   }
	   public int getHeight()
	   {
	      return height;
	   }
	   
	   
	   //alters the frames
	   public void setFrame(int input)
	   {
	      currentFrame = input;
	   }
	   public int getFrame()
	   {
	      return currentFrame;
	   }
	   public void changeFrame()
	   {
	      currentFrame++;
	   }
	   public void changeSprite()
	   {
	      wp = imageArray[currentFrame].getImage();
	   }
	   

}
	  